﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net.Config;
using NHibernate;
using NHibernate.Cfg;
using System.Web;

namespace DataAccess.NHibernate
{
    public class NHSessionFactory
    {
        public static ISession Context;

        public static void Init()
        {
            ISessionFactory factory = NHSessionFactory.BuildSessionFactory();
            Context = factory.OpenSession();
        }
     
        public static ISessionFactory BuildSessionFactory()
        {
            Configuration config = null;            
            config = new Configuration();                       

            log4net.Config.XmlConfigurator.Configure();                        
            config.Configure();

            return config.BuildSessionFactory();
        }
    }
}
